Realm Query
A RealmQuery encapsulates a query on a Realm, a RealmResults or a RealmList instance using the Builder pattern. The query is executed using either
A Realm is unordered, which means that there is no guarantee that a query will return the objects in the order they where inserted. Use the sort functions if a specific order is required.
Results are obtained quickly most of the times when using
Parameters
T
the class of the objects to be queried.
Functions
asFlow
Link copied to clipboard
count
Link copied to clipboard
find
Link copied to clipboard
first
Link copied to clipboard
limit
Link copied to clipboard
sort
Link copied to clipboard
Sorts the query result by the specific property name according to Pairs of properties and sorting order.
abstract fun sort(property: String, sortOrder: Sort = Sort.ASCENDING): RealmQuery<T>
Content copied to clipboard
Sorts the query result by the specific property name according to sortOrder, which is Sort.ASCENDING by default.
Extensions
find
Link copied to clipboard
fun <T : RealmObject, R> RealmQuery<T>.find(block: (RealmResults<T>) -> R): R
Content copied to clipboard
Similar to RealmQuery.find but it receives a block in which the RealmResults from the query are provided.
max
Link copied to clipboard
inline fun <T : Any> RealmQuery<*>.max(property: String): RealmScalarNullableQuery<T>
Content copied to clipboard
Similar to RealmQuery.max but the type parameter is automatically inferred.
min
Link copied to clipboard
inline fun <T : Any> RealmQuery<*>.min(property: String): RealmScalarNullableQuery<T>
Content copied to clipboard
Similar to RealmQuery.min but the type parameter is automatically inferred.
sum
Link copied to clipboard
inline fun <T : Any> RealmQuery<*>.sum(property: String): RealmScalarQuery<T>
Content copied to clipboard
Similar to RealmQuery.sum but the type parameter is automatically inferred.